package com.lzhsite.technology.designPattern.mediator.ColleagueDemo;

public class Mediator extends AbstractMediator {
	public void execute(String name, String method) {
		if ("self".equals(method)) {
			if ("ColleagueA".equals(name)) {
				ColleagueA colleagueA = (ColleagueA) super.colleagues.get("ColleagueA");
				colleagueA.self();
			} else {
				ColleagueB colleagueB = (ColleagueB) super.colleagues.get("ColleagueB");
				colleagueB.self();
			}
		} else {
			if ("ColleagueA".equals(name)) {
				ColleagueA colleagueA = (ColleagueA) super.colleagues.get("ColleagueA");
				colleagueA.out();
			} else {
				ColleagueB colleagueB = (ColleagueB) super.colleagues.get("ColleagueB");
				colleagueB.out();
			}
		}
	}
}
